/* eslint-disable no-undef */
import { createRouter, createMemoryHistory } from 'vue-router'
import Login from '@/views/login'
import User from '@/views/user'
import Hall from '@/views/user/ProductHall.vue'
import Order from '@/views/user/order.vue'
import Prodetail from '@/views/user/prodetail.vue'
import Search from '@/views/user/search'
import SearchList from '@/views/user/search/list.vue'



import Company from '@/views/company'
import Products from '@/views/company/products.vue'
import Orders from '@/views/company/orders.vue'
import Remarks from '@/views/company/remarks.vue'
import Upload from '@/views/company/upload.vue'
import Statistic from '@/views/company/statistic.vue'



const routes = [
    { path: '/', redirect: '/login' },
    { path: '/login', component: Login },
    {
        path: '/user',
        component: User,
        redirect: '/user/hall',
        children: [
            { path: '/user/hall', component: Hall },
            { path: '/user/order', component: Order },
            { path: '/user/prodetail', component: Prodetail },
            { path: '/user/search', component: Search },
            { path: '/user/searchlist', component: SearchList },
        ]
    },
    {
        path: '/company',
        component: Company,
        redirect: '/company/products',
        children: [
            { path: '/company/products', component: Products},
            { path: '/company/orders', component: Orders },
            { path: '/company/remarks', component: Remarks},
            { path: '/company/upload', component: Upload },
            { path: '/company/statistic', component: Statistic }
        ]
    },
]
const router = createRouter({
    // 路由的方式： 两种： 基于history   
    history: createMemoryHistory(),
    routes
})
export default router